/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package kn.cstf2.implementation.Server;

import java.security.Timestamp;
import kn.cstf2.cop.Bean.CopBean;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

import com.mx.kn.cstf2.dto.JoindocumenttransitionBean;

import kn.cstf2.global.Utils.CstF2Exception;
import kn.cstf2.global.db.Operations.OperacionesDB;
import kn.cstf2.implementation.Bean.*;
import kn.cstf2.implementation.Sql.ImplementationSql;
import kn.cstf2.transition.Bean.TransitionBean;
import kn.cstf2.transition.Shared.TransitionShared;



public class ImplementationServer {

       OperacionesDB odb = new OperacionesDB();
    
    
    public ClienteStkBean obtenerTodosDatosFromClientesSTK(Integer knkey) {
        
        ClienteStkBean clienteStkBean = new ClienteStkBean();
        Connection conn = null;
        PreparedStatement ps = null;
        ResultSet rs = null;
        String sentenciaSQL = ImplementationSql.SELECCIONAR_ALLDATACLIENTFROMSTK;
        int index = 1;
        
        try {
            conn = odb.obtenerConexion("db2");
            ps = conn.prepareStatement(sentenciaSQL);
            ps.setInt(index++, knkey);

            rs = ps.executeQuery();
            clienteStkBean = AdaptadorImple.obtenerTodosDatosFromClientesSTK(rs);         
        } catch (SQLException ex) {
            
            throw new CstF2Exception("Error al obtener el Usuario desde la base de datos");
        } finally {
            odb.cerrarResultSet(rs);
            odb.cerrarStatement(ps);
            odb.cerrarConnection(conn);
        }
        return clienteStkBean;
    }
    
    
        public T_asignStkBean obtenerIfOwnerFromSTK(Integer knkey) {
        
        T_asignStkBean t_asignStkBean = new T_asignStkBean();
        Connection conn = null;
        PreparedStatement ps = null;
        ResultSet rs = null;
        String sentenciaSQL = ImplementationSql.SELECCIONAR_IFOWNERFROMKNKEY;
        int index = 1;
        
        try {
            conn = odb.obtenerConexion("db2");
            ps = conn.prepareStatement(sentenciaSQL);
            ps.setInt(index++, knkey);

            rs = ps.executeQuery();
            t_asignStkBean = AdaptadorImple.obtenerIfOwnerFromSTK(rs);         
        } catch (SQLException ex) {
            
            throw new CstF2Exception("Error al obtener el Usuario desde la base de datos");
        } finally {
            odb.cerrarResultSet(rs);
            odb.cerrarStatement(ps);
            odb.cerrarConnection(conn);
        }
        return t_asignStkBean;
    }
        
        
     public JoindocumenttransitionBean obtenerStatusFechaArchivo(Integer idtransition, Integer iddocument) {
        
        JoindocumenttransitionBean joindocumenttransitionBean = new JoindocumenttransitionBean();
        Connection conn = null;
        PreparedStatement ps = null;
        ResultSet rs = null;
        String sentenciaSQL = ImplementationSql.SELECCIONAR_STATUSFECHAARCHIVO;
        int index = 1;
        
        try {
            conn = odb.obtenerConexion("db");
            ps = conn.prepareStatement(sentenciaSQL);
            ps.setInt(index++, idtransition);
            ps.setInt(index++, iddocument);

            rs = ps.executeQuery();
            joindocumenttransitionBean = AdaptadorImple.obtenerStatusFechaArchivo(rs);         
        } catch (SQLException ex) {
            
            throw new CstF2Exception("Error al obtener el Usuario desde la base de datos");
        } finally {
            odb.cerrarResultSet(rs);
            odb.cerrarStatement(ps);
            odb.cerrarConnection(conn);
        }
        return joindocumenttransitionBean;
    }
        
   
     public TransitionBean obtenerTransitionBeanIdKnkeyByKnkey(TransitionBean transitionBean) {

        Connection conn = null;
        PreparedStatement ps = null;
        ResultSet rs = null;
        String sentenciaSQL = ImplementationSql.SELECCIONAR_IDKNKEY;
        int index = 1;
        
        try {
            conn = odb.obtenerConexion("db");
            ps = conn.prepareStatement(sentenciaSQL);
            ps.setInt(index++, transitionBean.getKnkey());

            rs = ps.executeQuery();
            transitionBean = AdaptadorImple.obtenerTransitionBean(rs);         
        } catch (SQLException ex) {
            
            throw new CstF2Exception("Error al obtener el Usuario desde la base de datos");
        } finally {
            odb.cerrarResultSet(rs);
            odb.cerrarStatement(ps);
            odb.cerrarConnection(conn);
        }
        return transitionBean;
    }
        
     
     
        public DocumentsBean obtenerIdFromDocuments() {
            
        DocumentsBean documentsBean = new DocumentsBean();       
        //Joinusertransition joinusertransition = new Joinusertransition();
        TransitionBean  transitionBean = new TransitionBean();
        
        Connection conn = null;
        PreparedStatement ps = null;
        ResultSet rs = null;
        String sentenciaSQL = ImplementationSql.SELECCIONAR_IDDOCUMENTS;
        int index = 1;
        
        try {
            conn = odb.obtenerConexion("db");
            ps = conn.prepareStatement(sentenciaSQL);
            ps.setInt(index++, documentsBean.getId());

            rs = ps.executeQuery();
            documentsBean = AdaptadorImple.obtenerIdFromDocuments(rs);         
        } catch (SQLException ex) {
            
            throw new CstF2Exception("Error al obtener el Usuario desde la base de datos");
        } finally {
            odb.cerrarResultSet(rs);
            odb.cerrarStatement(ps);
            odb.cerrarConnection(conn);
        }
        return documentsBean;
    }
    
        
       public TransitionsBeanImp obtenerllRestInforT_transition(Integer id) {
            
        TransitionsBeanImp transitionsBeanImp = new TransitionsBeanImp();       
      
        Connection conn = null;
        PreparedStatement ps = null;
        ResultSet rs = null;
        String sentenciaSQL = ImplementationSql.SELECCIONAR_ALLRESTOFTRANSITION;
        int index = 1;
        
        try {
            conn = odb.obtenerConexion("db");
            ps = conn.prepareStatement(sentenciaSQL);
            ps.setInt(index++, id);

            rs = ps.executeQuery();
            transitionsBeanImp = AdaptadorImple.obtenerllRestInforT_transition(rs);         
        } catch (SQLException ex) {
            
            throw new CstF2Exception("Error al obtener el Usuario desde la base de datos");
        } finally {
            odb.cerrarResultSet(rs);
            odb.cerrarStatement(ps);
            odb.cerrarConnection(conn);
        }
        return transitionsBeanImp;
    }
     
       public TransitionsBeanImp actualizarStatusDocumentsCop(Integer id, Boolean status, String date, String fechas){
       TransitionsBeanImp transitionsBeanImp = new TransitionsBeanImp();
        Connection conn = null;
        PreparedStatement ps = null;
        ResultSet rs = null;
        String sentenciaSQL = ImplementationSql.UPDATE_STATUS_DOCUMENT_COP;
        int index = 1;
        
        try {
        TransitionShared transitionShared = new TransitionShared();
        Date myfechamehodDate =transitionShared.GetTheDateTime();
        DateFormat dateFormat = new SimpleDateFormat("yyyy-mm-dd HH:mm:ss");
        String fecha=dateFormat.format(myfechamehodDate);
            
            conn = odb.obtenerConexion("db");
            ps = conn.prepareStatement(sentenciaSQL);
            ps.setBoolean(index++, status);
            ps.setString(index++, date);
            ps.setString(index++, fechas);
            ps.setInt(index++, id);

            rs = ps.executeQuery();
            
            transitionsBeanImp = AdaptadorImple.actualizarStatusDocumentsCop(rs);         
        } catch (SQLException ex) {
            
            throw new CstF2Exception("Error al obtener el Usuario desde la base de datos");
        } finally {
            odb.cerrarResultSet(rs);
            odb.cerrarStatement(ps);
            odb.cerrarConnection(conn);
        }
        return transitionsBeanImp;
    }
       
       public TransitionsBeanImp actualizarStatusDocumentsContacts(Integer id, Boolean status, String date, String fechas){
       TransitionsBeanImp transitionsBeanImp = new TransitionsBeanImp();
        Connection conn = null;
        PreparedStatement ps = null;
        ResultSet rs = null;
        String sentenciaSQL = ImplementationSql.UPDATE_STATUS_DOCUMENT_CONTACTS;
        int index = 1;
        
        try {
        TransitionShared transitionShared = new TransitionShared();
        Date myfechamehodDate =transitionShared.GetTheDateTime();
        DateFormat dateFormat = new SimpleDateFormat("yyyy-mm-dd HH:mm:ss");
        String fecha=dateFormat.format(myfechamehodDate);
            
            conn = odb.obtenerConexion("db");
            ps = conn.prepareStatement(sentenciaSQL);
            ps.setBoolean(index++, status);
            ps.setString(index++, date);
            ps.setString(index++, fechas);
            ps.setInt(index++, id);

            rs = ps.executeQuery();
            
            transitionsBeanImp = AdaptadorImple.actualizarStatusDocumentsContacts(rs);         
        } catch (SQLException ex) {
            
            throw new CstF2Exception("Error al obtener el Usuario desde la base de datos");
        } finally {
            odb.cerrarResultSet(rs);
            odb.cerrarStatement(ps);
            odb.cerrarConnection(conn);
        }
        return transitionsBeanImp;
    }
       
       public TransitionsBeanImp actualizarStatusDocumentsReporting(Integer id, Boolean status, String date, String fechas){
       TransitionsBeanImp transitionsBeanImp = new TransitionsBeanImp();
        Connection conn = null;
        PreparedStatement ps = null;
        ResultSet rs = null;
        String sentenciaSQL = ImplementationSql.UPDATE_STATUS_DOCUMENT_REPORTING;
        int index = 1;
        
        try {
        TransitionShared transitionShared = new TransitionShared();
        Date myfechamehodDate =transitionShared.GetTheDateTime();
        DateFormat dateFormat = new SimpleDateFormat("yyyy-mm-dd HH:mm:ss");
        String fecha=dateFormat.format(myfechamehodDate);
            
            conn = odb.obtenerConexion("db");
            ps = conn.prepareStatement(sentenciaSQL);
            ps.setBoolean(index++, status);
            ps.setString(index++, date);
            ps.setString(index++, fechas);
            ps.setInt(index++, id);

            rs = ps.executeQuery();
            
            transitionsBeanImp = AdaptadorImple.actualizarStatusDocumentsReporting(rs);         
        } catch (SQLException ex) {
            
            throw new CstF2Exception("Error al obtener el Usuario desde la base de datos");
        } finally {
            odb.cerrarResultSet(rs);
            odb.cerrarStatement(ps);
            odb.cerrarConnection(conn);
        }
        return transitionsBeanImp;
    }
       
       public TransitionsBeanImp actualizarStatusDocumentsSos(Integer id, Boolean status, String date, String fechas){
       TransitionsBeanImp transitionsBeanImp = new TransitionsBeanImp();
        Connection conn = null;
        PreparedStatement ps = null;
        ResultSet rs = null;
        String sentenciaSQL = ImplementationSql.UPDATE_STATUS_DOCUMENT_SOS;
        int index = 1;
        
        try {
        TransitionShared transitionShared = new TransitionShared();
        Date myfechamehodDate =transitionShared.GetTheDateTime();
        DateFormat dateFormat = new SimpleDateFormat("yyyy-mm-dd HH:mm:ss");
        String fecha=dateFormat.format(myfechamehodDate);
            
            conn = odb.obtenerConexion("db");
            ps = conn.prepareStatement(sentenciaSQL);
            ps.setBoolean(index++, status);
            ps.setString(index++, date);
            ps.setString(index++, fechas);
            ps.setInt(index++, id);

            rs = ps.executeQuery();
            
            transitionsBeanImp = AdaptadorImple.actualizarStatusDocumentsSos(rs);         
        } catch (SQLException ex) {
            
            throw new CstF2Exception("Error al obtener el Usuario desde la base de datos");
        } finally {
            odb.cerrarResultSet(rs);
            odb.cerrarStatement(ps);
            odb.cerrarConnection(conn);
        }
        return transitionsBeanImp;
    }
       
       public TransitionsBeanImp actualizarStatusDocumentsConditions(Integer id, Boolean status, String date, String fechas){
       TransitionsBeanImp transitionsBeanImp = new TransitionsBeanImp();
        Connection conn = null;
        PreparedStatement ps = null;
        ResultSet rs = null;
        String sentenciaSQL = ImplementationSql.UPDATE_STATUS_DOCUMENT_CONDITIONS;
        int index = 1;
        
        try {
        TransitionShared transitionShared = new TransitionShared();
        Date myfechamehodDate =transitionShared.GetTheDateTime();
        DateFormat dateFormat = new SimpleDateFormat("yyyy-mm-dd HH:mm:ss");
        String fecha=dateFormat.format(myfechamehodDate);
            
            conn = odb.obtenerConexion("db");
            ps = conn.prepareStatement(sentenciaSQL);
            ps.setBoolean(index++, status);
            ps.setString(index++, date);
            ps.setString(index++, fechas);
            ps.setInt(index++, id);

            rs = ps.executeQuery();
            
            transitionsBeanImp = AdaptadorImple.actualizarStatusDocumentsConditions(rs);         
        } catch (SQLException ex) {
            
            throw new CstF2Exception("Error al obtener el Usuario desde la base de datos");
        } finally {
            odb.cerrarResultSet(rs);
            odb.cerrarStatement(ps);
            odb.cerrarConnection(conn);
        }
        return transitionsBeanImp;
    }
     
       public TransitionsBeanImp actualizarStatusDocumentsCielID(Integer id, Boolean cielIDStatus, String date, String fechas){
       TransitionsBeanImp transitionsBeanImp = new TransitionsBeanImp();
        Connection conn = null;
        PreparedStatement ps = null;
        ResultSet rs = null;
        String sentenciaSQL = ImplementationSql.UPDATE_STATUSDOCUMENT_CIELID;
        int index = 1;
        
        try {
        TransitionShared transitionShared = new TransitionShared();
        Date myfechamehodDate =transitionShared.GetTheDateTime();
        DateFormat dateFormat = new SimpleDateFormat("yyyy-mm-dd HH:mm:ss");
        String fecha=dateFormat.format(myfechamehodDate);
            
            conn = odb.obtenerConexion("db");
            ps = conn.prepareStatement(sentenciaSQL);
            ps.setBoolean(index++, cielIDStatus);
            ps.setString(index++, date);
            ps.setString(index++, fechas);
            ps.setInt(index++, id);

            rs = ps.executeQuery();
            
            transitionsBeanImp = AdaptadorImple.actualizarStatusDocumentsCielID(rs);         
        } catch (SQLException ex) {
            
            throw new CstF2Exception("Error al obtener el Usuario desde la base de datos");
        } finally {
            odb.cerrarResultSet(rs);
            odb.cerrarStatement(ps);
            odb.cerrarConnection(conn);
        }
        return transitionsBeanImp;
    }
       
     
     
       public TransitionsBeanImp actualizarStatusDocumentsCielQ(Integer id, Boolean cielQuotationStatus, String date, String fechas){
       TransitionsBeanImp transitionsBeanImp = new TransitionsBeanImp();
        Connection conn = null;
        PreparedStatement ps = null;
        ResultSet rs = null;
        String sentenciaSQL = ImplementationSql.UPDATE_STATUS_DOCUMEWNT_CIELQ;
        int index = 1;
        
        try {
            conn = odb.obtenerConexion("db");
            ps = conn.prepareStatement(sentenciaSQL);
            
            ps.setBoolean(index++, cielQuotationStatus);
            ps.setString(index++, date);
            ps.setString(index++, fechas);
            ps.setInt(index++, id);

            rs = ps.executeQuery();
            
            transitionsBeanImp = AdaptadorImple.actualizarStatusDocumentsCielQ(rs);         
        } catch (SQLException ex) {
            
            throw new CstF2Exception("Error al obtener el Usuario desde la base de datos");
        } finally {
            odb.cerrarResultSet(rs);
            odb.cerrarStatement(ps);
            odb.cerrarConnection(conn);
        }
        return transitionsBeanImp;
    }
       
     
       public TransitionsBeanImp actualizarStatusDocumentsCarrier(Integer id, Boolean carrierChoise, String date, String fechas){
      
       TransitionsBeanImp transitionsBeanImp = new TransitionsBeanImp();
            
        Connection conn = null;
        PreparedStatement ps = null;
        ResultSet rs = null;
        String sentenciaSQL = ImplementationSql.UPDATE_STATUS_DOCUMENT_CARRIER;
        int index = 1;
        
        try {
            conn = odb.obtenerConexion("db");
            ps = conn.prepareStatement(sentenciaSQL);
            
            ps.setBoolean(index++, carrierChoise);
            ps.setString(index++, date);
            ps.setString(index++, fechas);
            ps.setInt(index++, id);

            rs = ps.executeQuery();
            
            transitionsBeanImp = AdaptadorImple.actualizarStatusDocumentsCarrier(rs);         
        } catch (SQLException ex) {
            
            throw new CstF2Exception("Error al obtener el Usuario desde la base de datos");
        } finally {
            odb.cerrarResultSet(rs);
            odb.cerrarStatement(ps);
            odb.cerrarConnection(conn);
        }
        return transitionsBeanImp;
    }
       
    public TransitionsBeanImp actualizarStatusDocumentsWorking(Integer id, Boolean status, String date, String fechas){
       TransitionsBeanImp transitionsBeanImp = new TransitionsBeanImp();
        Connection conn = null;
        PreparedStatement ps = null;
        ResultSet rs = null;
        String sentenciaSQL = ImplementationSql.UPDATE_STATUS_DOCUMENT_WORKING;
        int index = 1;
        
        try {
        TransitionShared transitionShared = new TransitionShared();
        Date myfechamehodDate =transitionShared.GetTheDateTime();
        DateFormat dateFormat = new SimpleDateFormat("yyyy-mm-dd HH:mm:ss");
        String fecha=dateFormat.format(myfechamehodDate);
            
            conn = odb.obtenerConexion("db");
            ps = conn.prepareStatement(sentenciaSQL);
            ps.setBoolean(index++, status);
            ps.setString(index++, date);
            ps.setString(index++, fechas);
            ps.setInt(index++, id);

            rs = ps.executeQuery();
            
            transitionsBeanImp = AdaptadorImple.actualizarStatusDocumentsWorking(rs);         
        } catch (SQLException ex) {
            
            throw new CstF2Exception("Error al obtener el Usuario desde la base de datos");
        } finally {
            odb.cerrarResultSet(rs);
            odb.cerrarStatement(ps);
            odb.cerrarConnection(conn);
        }
        return transitionsBeanImp;
    }
    
    public TransitionsBeanImp actualizarStatusDocumentsSop(Integer id, Boolean status, String date, String fechas){
       TransitionsBeanImp transitionsBeanImp = new TransitionsBeanImp();
        Connection conn = null;
        PreparedStatement ps = null;
        ResultSet rs = null;
        String sentenciaSQL = ImplementationSql.UPDATE_STATUS_DOCUMENT_SOP;
        int index = 1;
        
        try {
        TransitionShared transitionShared = new TransitionShared();
        Date myfechamehodDate =transitionShared.GetTheDateTime();
        DateFormat dateFormat = new SimpleDateFormat("yyyy-mm-dd HH:mm:ss");
        String fecha=dateFormat.format(myfechamehodDate);
            
            conn = odb.obtenerConexion("db");
            ps = conn.prepareStatement(sentenciaSQL);
            ps.setBoolean(index++, status);
            ps.setString(index++, date);
            ps.setString(index++, fechas);
            ps.setInt(index++, id);

            rs = ps.executeQuery();
            
            transitionsBeanImp = AdaptadorImple.actualizarStatusDocumentsSop(rs);         
        } catch (SQLException ex) {
            
            throw new CstF2Exception("Error al obtener el Usuario desde la base de datos");
        } finally {
            odb.cerrarResultSet(rs);
            odb.cerrarStatement(ps);
            odb.cerrarConnection(conn);
        }
        return transitionsBeanImp;
    }
    
    public TransitionsBeanImp actualizarStatusDocumentsKpi(Integer id, Boolean status, String date, String fechas){
       TransitionsBeanImp transitionsBeanImp = new TransitionsBeanImp();
        Connection conn = null;
        PreparedStatement ps = null;
        ResultSet rs = null;
        String sentenciaSQL = ImplementationSql.UPDATE_STATUS_DOCUMENT_KPI;
        int index = 1;
        
        try {
        TransitionShared transitionShared = new TransitionShared();
        Date myfechamehodDate =transitionShared.GetTheDateTime();
        DateFormat dateFormat = new SimpleDateFormat("yyyy-mm-dd HH:mm:ss");
        String fecha=dateFormat.format(myfechamehodDate);
            
            conn = odb.obtenerConexion("db");
            ps = conn.prepareStatement(sentenciaSQL);
            ps.setBoolean(index++, status);
            ps.setString(index++, date);
            ps.setString(index++, fechas);
            ps.setInt(index++, id);

            rs = ps.executeQuery();
            
            transitionsBeanImp = AdaptadorImple.actualizarStatusDocumentsKpi(rs);         
        } catch (SQLException ex) {
            
            throw new CstF2Exception("Error al obtener el Usuario desde la base de datos");
        } finally {
            odb.cerrarResultSet(rs);
            odb.cerrarStatement(ps);
            odb.cerrarConnection(conn);
        }
        return transitionsBeanImp;
    }
    
    public TransitionsBeanImp actualizarStatusDocumentsBilling(Integer id, Boolean status, String date, String fechas){
       TransitionsBeanImp transitionsBeanImp = new TransitionsBeanImp();
        Connection conn = null;
        PreparedStatement ps = null;
        ResultSet rs = null;
        String sentenciaSQL = ImplementationSql.UPDATE_STATUS_DOCUMENT_BILLING;
        int index = 1;
        
        try {
        TransitionShared transitionShared = new TransitionShared();
        Date myfechamehodDate =transitionShared.GetTheDateTime();
        DateFormat dateFormat = new SimpleDateFormat("yyyy-mm-dd HH:mm:ss");
        String fecha=dateFormat.format(myfechamehodDate);
            
            conn = odb.obtenerConexion("db");
            ps = conn.prepareStatement(sentenciaSQL);
            ps.setBoolean(index++, status);
            ps.setString(index++, date);
            ps.setString(index++, fechas);
            ps.setInt(index++, id);

            rs = ps.executeQuery();
            
            transitionsBeanImp = AdaptadorImple.actualizarStatusDocumentsBilling(rs);         
        } catch (SQLException ex) {
            
            throw new CstF2Exception("Error al obtener el Usuario desde la base de datos");
        } finally {
            odb.cerrarResultSet(rs);
            odb.cerrarStatement(ps);
            odb.cerrarConnection(conn);
        }
        return transitionsBeanImp;
    }
       
     public DateStatusTransitionsBean obtenerFechaStatusTransitions(Integer id){
      
       DateStatusTransitionsBean dateStatusTransitionsBean = new DateStatusTransitionsBean();
            
        Connection conn = null;
        PreparedStatement ps = null;
        ResultSet rs = null;
        String sentenciaSQL = ImplementationSql.GETDATE_STATUSTRANSITIONS;
        int index = 1;
        
        try {
            conn = odb.obtenerConexion("db");
            ps = conn.prepareStatement(sentenciaSQL);
            ps.setInt(index++, id);

            rs = ps.executeQuery();
            
            dateStatusTransitionsBean = AdaptadorImple.obtenerFechaStatusTransitions(rs);         
        } catch (SQLException ex) {
            
            throw new CstF2Exception("Error al obtener el Usuario desde la base de datos");
        } finally {
            odb.cerrarResultSet(rs);
            odb.cerrarStatement(ps);
            odb.cerrarConnection(conn);
        }
        return dateStatusTransitionsBean;
    }
       
     public DateStatusTransitionsBean obtenerDateStatusTransitions(Integer id){
      
       DateStatusTransitionsBean dateStatusTransitionsBean = new DateStatusTransitionsBean();
            
        Connection conn = null;
        PreparedStatement ps = null;
        ResultSet rs = null;
        String sentenciaSQL = ImplementationSql.GETDATE_STATUSTRANSITIONS;
        int index = 1;
        
        try {
            conn = odb.obtenerConexion("db");
            ps = conn.prepareStatement(sentenciaSQL);
            ps.setInt(index++, id);

            rs = ps.executeQuery();
            
            dateStatusTransitionsBean = AdaptadorImple.obtenerDatesStatusTransitions(rs);         
        } catch (SQLException ex) {
            
            throw new CstF2Exception("Error al obtener el Usuario desde la base de datos");
        } finally {
            odb.cerrarResultSet(rs);
            odb.cerrarStatement(ps);
            odb.cerrarConnection(conn);
        }
        return dateStatusTransitionsBean;
    }  
       
       
     public JoindocumenttransitionBean obtenerJoindocumenttransitionData(TransitionBean transitionBean) {
        JoindocumenttransitionBean joindocumenttransitionBean=new JoindocumenttransitionBean();
        
        Connection conn = null;
        PreparedStatement ps = null;
        ResultSet rs = null;
        String sentenciaSQL = ImplementationSql.SELECCIONAR_JOINDOCUMENTTRANSITIONDATA;
        int index = 1;
        
        try {
            conn = odb.obtenerConexion("db");
            ps = conn.prepareStatement(sentenciaSQL);
            ps.setInt(index++, transitionBean.getId());

            rs = ps.executeQuery();
            joindocumenttransitionBean = AdaptadorImple.obtenerJoindocumenttransitionData(rs);         
        } catch (SQLException ex) {
            
            throw new CstF2Exception("Error al obtener el Usuario desde la base de datos");
        } finally {
            odb.cerrarResultSet(rs);
            odb.cerrarStatement(ps);
            odb.cerrarConnection(conn);
        }
        return joindocumenttransitionBean;
    }
     
     
}
